const { fs, path } = require('@vuepress/shared-utils');

module.exports = ctx => ({
	title: '个人博客',
	description: `个人博客`,
	ga: '',
	base: '/blog/',
	serviceWorker: true,
	evergreen: true,
	// dest: '../',
	head: [['link', { rel: 'icon', href: 'favicon.ico' }]],
	themeConfig: {
		// 配置github 的地址
		repo: 'https://github.com/imisou',
		lastUpdated: '上次更新',
		nav: require('./nav'),
		sidebarDepth: 2,
		sidebar: require('./sidebar')
	},
	markdown: {
		anchor: {
			permalink: true
		},
		toc: {
			includeLevel: [1, 2]
		},
		config: md => {
			// 使用更多 markdown-it 插件！
			md.use(require('markdown-it-task-lists')).use(require('markdown-it-imsize'), { autofill: true });
		}
	},
	//
	configureWebpack: {
		// 配置别名
		resolve: {
			alias: {
				'@admin': './public/admin'
			}
		}
	},
	plugins: [
		['@vuepress/back-to-top', true],
		[
			'@vuepress/pwa',
			{
				serviceWorker: true,
				updatePopup: true
			}
		],
		['@vuepress/medium-zoom', true],
		[
			'@vuepress/google-analytics',
			{
				ga: 'UA-128189152-1'
			}
		],
		[
			'container',
			{
				type: 'vue',
				before: '<pre class="vue-container"><code>',
				after: '</code></pre>'
			}
		],
		[
			'container',
			{
				type: 'upgrade',
				before: info => `<UpgradePath title="${info}">`,
				after: '</UpgradePath>'
			}
		]
	]
});
